<?php
/**
 * Модель config
 * 
 * Класс модели
 * @author Anton Zavidov
 * @package myLiveShop
 */

/**
 * Модель config
 *
 */
class ModelConfig extends Model {
	
	const TABLE				= 'config';
	const F_NAME  	= 'name';
	const F_VALUE  	= 'value';
	const F_DYNAMIC  	= 'dynamic';
	const F_UPDATED  	= 'updated';
	const F_USER_ID  	= 'user_id';
			
	public function __construct($className=null){
		parent::__construct(__CLASS__);
		$this->name='config';
		$this->id_field=array(self::F_NAME);
		$this->fields=array(
		self::TABLE.DOT.self::F_NAME=> new Field($this,self::F_NAME,self::TABLE,array(
				'important'=>true,
				'lenght'=>255,
				'type'=>Field::TYPE_STRING)),
		self::TABLE.DOT.self::F_VALUE=> new Field($this,self::F_VALUE,self::TABLE,array(
				'auto'=>true,
				'lenght'=>255,
				'type'=>Field::TYPE_STRING)),
		self::TABLE.DOT.self::F_DYNAMIC=> new Field($this,self::F_DYNAMIC,self::TABLE,array(
				'auto'=>true,
				'lenght'=>1,
				'validate_type'=>Validator::VALIDATE_BOOL)),
		self::TABLE.DOT.self::F_UPDATED=> new Field($this,self::F_UPDATED,self::TABLE,array(
				'important'=>true,
				'auto'=>true,
				'type'=>Field::TYPE_DATETIME)),
		self::TABLE.DOT.self::F_USER_ID=> new Field($this,self::F_USER_ID,self::TABLE,array(
				'lenght'=>11,
				'join_table'=>'user'))		);
	}
}
